﻿#ifndef ISAVE_H
#define ISAVE_H

#include <QString>

class SavePrivate;
class ISave
{
public:
    ISave(int version, const QString &name, bool autoLoad = false, bool autoSave = false);//name为空或version为0时屏蔽接口
    virtual ~ISave();

protected:
    void load();//手动重新载入
    void save(bool canSaveAngin = true);//手动重新保存
    static int dataStreamVersion();
    static QString dataDir();
    QString saveFileName() const;
    QString backUpFileName() const;

    virtual void loadOldData(const QByteArray &saveCurrentData, int version);//version为0时表示没有保存数据
    virtual QByteArray saveCurrentData();
    virtual void loadCurrentVersionOldData(QDataStream &ds);
    virtual void saveCurrentVersionCurrentData(QDataStream &ds);

private:
    SavePrivate * const d_ptr;
    friend class SavePrivate;
};

#endif // ISAVE_H
